<template>
  <div>
    <div flex flex-a-c flex-j-c text-center>
      <div mt-200rpx>
        <div my-20rpx text-32rpx>
          <div mb-40rpx>
            <nut-icon size="80rpx" name="success"></nut-icon>
          </div>
          {{ routerVal.orderType === 'RECHARGE' ? '预存款充值' : '订单支付' }}成功!
        </div>

        <div mb-40rpx text-50rpx font-bold>
          {{ unitPrice(routerVal.payPrice || 0, '￥') }}
        </div>

        <div flex flex-a-c gap-40rpx>
          <nut-button v-if="routerVal.orderType === 'RECHARGE'" @click="back">返回</nut-button>
          <nut-button v-else @click="order">查看订单</nut-button>
          <nut-button @click="backToHome">回到首页</nut-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { unitPrice } from '@/utils/filters';
import { onLoad } from '@dcloudio/uni-app';
const routerVal = ref<any>('')


function backToHome() {
  uni.switchTab({
    url: "/pages/mall"
  })
}

function back() {
  uni.navigateBack({
    delta: 2
  });
}

function order(){
  uni.redirectTo({
    url: "/pages/mine/order/list"
  })
}

onLoad((options: any) => {
  routerVal.value = options
})
</script>

<style scoped>
page,
:root {
  background: #fff;
}
</style>

<style scoped lang="scss"></style>
